package com.mlethe.android.demo.recyclerview.adapter;

import androidx.annotation.NonNull;

import com.mlethe.android.demo.R;
import com.mlethe.library.recyclerview.adapter.BaseQuickAdapter;
import com.mlethe.library.recyclerview.viewholder.ViewHolder;
import com.mlethe.library.recyclerview.listener.MultiTypeSupport;

public class RecyclerViewAdapter extends BaseQuickAdapter<Test> {
    public RecyclerViewAdapter() {
        super(new MultiTypeSupport<Test>() {
            @Override
            public int getLayoutId(Test item, int position) {
                if (position % 2 == 0) {
                    return R.layout.item_recycler_view_adapter_text_2;
                }
                return R.layout.item_recycler_view_adapter_text;
            }
        });
    }

    @Override
    protected void convert(@NonNull ViewHolder holder, Test item, int position) {
        holder.setText(R.id.text_view, item.getName());
    }
}
